<template>
  <div>
    <div class="title">
      <h1 class="title-text">心理咨询</h1>
    </div>
    <el-menu
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      @select="menuClick"
    >
      <el-submenu index="/main" v-if="adminAccess == 1 || adminAccess == 2">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>初访管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/initiaVisit" v-if="adminAccess == 1"
            >初访审核</el-menu-item
          >
          <el-menu-item
            index="/main/initiaPass"
            v-if="adminAccess == 1 || adminAccess == 2"
            >审核成功列表</el-menu-item
          >
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="2" v-if="adminAccess != 2">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>咨询管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item
            index="/main/consultation"
            v-if="adminAccess == 1 || adminAccess == 4"
            >咨询审核</el-menu-item
          >
          <el-menu-item
            index="/main/consultationPass"
            v-if="adminAccess == 1 || adminAccess == 3"
            >咨询成功列表</el-menu-item
          >
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="3" v-if="adminAccess == 1">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>账号管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/stu">用户列表</el-menu-item>
          <el-menu-item index="/main/admain">管理员列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item index="/main/workTime" v-if="adminAccess == 1">
        <i class="el-icon-setting"></i>
        <span slot="title">值班表管理</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  mounted() {},
  computed: {
    adminAccess() {
      return this.$store.state.adminInfo.adminAccess;
    },
  },
  methods: {
    handleOpen(key, keyPath) {},
    handleClose(key, keyPath) {},
    menuClick(index) {
      this.$router.push(index).catch((err) => {});
    },
    consultation() {
      this.$router.push({ path: "/main/consultation" }).catch((err) => {});
    },
    consultationPass() {
      this.$router.push({ path: "/main/consultationPass" }).catch((err) => {});
    },
    stu() {
      this.$router.push({ path: "/main/stu" }).catch((err) => {});
    },
    admin() {
      this.$router.push({ path: "/main/admain" }).catch((err) => {});
    },
    work() {
      this.$router.push({ path: "/main/workTime" }).catch((err) => {});
    },
  },
};
</script>
<style scoped lang="scss">
ul.el-menu-vertical-demo.el-menu {
  height: 100vh;
}
.title {
  font-size: 20px;
  font-weight: 900;
  background-color: #545c64;
  color: #fff;
  .title-text {
    padding: 30px 0 10px 0px;
    text-align: center;
  }
}
.el-submenu .el-menu-item {
  min-width: 0px;
}
</style>
